home *** CD-ROM | disk | FTP | other *** search
-
- ; Comments.fm (c)1999 Richard Gordon Faika
-
- ; Inserts a comment character (the semicolon), for assembler, for instance,
- ; at the start of the text string to be filtered.
-
- ; --------------------------------------------------------------------
- ; Get parameters
- ; --------------------------------------------------------------------
- move 4(sp),d0 ; Get function number
- move.l 6(sp),a0 ; Get text-string address
- move.l 10(sp),a1 ; Get address of working buffer
- move 14(sp),d1 ; Get length of string
- ; move 16(sp),d2 ; Length of working buffer is not needed
-
- tst d0 ; Filter?
- beq filter
-
- cmpi #1,d0
- bne case1
- bra GetInfo ; Info
- case1:
- cmpi #2,d0
- bne case2
- bra ModInit ; Init
- case2:
- cmpi #3,d0
- bne noFunc
- bra ModExit ; Exit
-
- ModInit:
- clr.l d0 ; There is nothing to initialise
- rts
- ModExit:
- clr.l d0 ; There is also nothing to deinitialise
- rts
-
- GetInfo: lea.l info(pc),a0 ; Return pointer to info-text
- move.l a0,d0
- rts
-
- noFunc: moveq.l #-32,d0
- rts
-
-
-
- ; --------------------------------------------------------------------
- ; Filter routine
- ; --------------------------------------------------------------------
-
- filter: tst d1 ; Test string length
- beq exit0 ; If zero, do nothing
-
- move.b #';',(a1)+ ; Insert comment character
-
- ; Copy remaining text
-
- lsr #1,d1 ; /2
- bcc.b go2 ; Divisible by 2?
- move.b (a0)+,(a1)+ ; No, so first character
- go2:
- lsr #1,d1 ; /2
- bcc go_all ; Divisible by 2?
- bra go24 ; No, so first two characters
- go4:
- move.b (a0)+,(a1)+
- move.b (a0)+,(a1)+
- go24:
- move.b (a0)+,(a1)+
- move.b (a0)+,(a1)+
- go_all:
- dbra d1,go4 ; Always 4 at a time
-
-
-
- clr.b (a1) ; Null-terminate string
- exit: move.l #1,d0 ; 0 = OK
- rts
- exit0: clr.l d0
- rts
-
-
-
- workbuf: dc.l 0
- info: dc.b ' Comments',0 ; Module info for popup, max. 24 chars.+nullbyte
- dc.b 'Richard Gordon Faika',0 ; Author's name, max. 20 chars.+nullbyte
- dc.b 'THE MODULE INSERTS A SEMICOLON AT',0 ; Max. 40 characters+nullbyte
- dc.b 'THE START OF A SELECTED TEXT STRING',0 ; Max. 40 characters+nullbyte
- dc.b 'AND SO TURNS IT INTO A COMMENT IN, SAY,',0 ; Max. 40 characters+nullbyte
- dc.b 'ASSEMBLER SOURCECODE.',0 ; Max. 40 characters+nullbyte
-